﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.Serialization;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using UpdaterForm;
using UpdaterForm.CustomTreeView;

namespace TestProject
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestSerialize()
        {
            var conf = new Configuration
            {
                Data = new Data
                {
                    AppData = new List<AppData>
                    {
                        new AppData
                        {
                            AppName = "Watchdog",
                            CurrentVersion = "20140719",
                            InstallationPath = @"C:\Thesis\Watchdog"
                        },
                        new AppData
                        {
                            AppName = "Wire",
                            CurrentVersion = "20140719",
                            InstallationPath = @"C:\Thesis\Wire"
                        }
                    }
                }
            };
            var writer = new XmlSerializer(typeof(Configuration));
            var file = new StreamWriter(@"C:\Thesis\Conf.xml");
            writer.Serialize(file, conf);
            file.Close();
        }

        [TestMethod]
        public void TestFileCreate()
        {
            var tree = new FolderNode(new DirectoryInfo(@"W:\Study\Updater\Repo\20140722\Watchdog"), @"C:\Thesis\Watchdog");
            tree.Apply(false);
        }
    }
}
